#include <iostream>
#include <vector>
using namespace std;

class App {
	int cnt;
	vector<int> head, next, to;
        vector<int> vertex;

	int power;
        int ans;
        vector<int> deep;
	vector<vector<int> > stjump;

	int log2(int n)
	{
		int ans = 0;
		while ((1 << ans) <= n >> 1) {
			ans++;
		}
		return ans;
	}

	void addedge(int u, int v)
	{
		next[cnt] = head[u];
		to[cnt] = v;
		head[u] = cnt++;
	}

	void dfs(int u, int p)
	{
                deep[u] = deep[p] + 1;
                stjump[u][0] = p;
                for(int p = 1; p <= power; p++){
                        stjump[u][p] = stjump[stjump[u][p - 1]][p - 1];
                }
                for(int e = head[u], v; e; e = next[e]){
                        v = to[e];
                        if(v != p){
                                dfs(v, u);
                        }
                }
	}

        int lca(int u, int v)
        {
                if(deep[u] < deep[v]){
                        swap(u, v);
                }

                int k = deep[u] - deep[v];
                for(int p = log2(k); p >= 0; p--){
                        if(deep[stjump[u][p]] >= deep[v]){
                                u = stjump[u][p];
                        }
                }
                if(u == v){
                        return u;
                }

                k = deep[v];
                for(int p = log2(k); p >= 0; p--){
                        if(stjump[u][p] != stjump[v][p]){
                                u = stjump[u][p];
                                v = stjump[v][p];
                        }
                }
                return stjump[u][0];
        }

        void dfs2(int u, int p, int m)
        {
                for(int e = head[u], v, w; e; e = next[e]){
                        v = to[e];
                        if(v != p){
                                dfs2(v, u, m);
                                // w = vertex[v];
                                // if(w == 0){
                                //         ans += m;
                                // }else if( w == 1){
                                //         ans += 1;
                                // }
                                // vertex[u] += w;
                        }
                }
                for (int e = head[u], v, w; e != 0; e = next[e]) {
			v = to[e];
			if (v != p) {
				w = 0 + vertex[v];
				if (w == 0) {
					ans += m;
				} else if (w == 1) {
					ans += 1;
				} else {
					ans += 0;
				}
				vertex[u] += vertex[v];
			}
		}
        }

    public:
	App(int n, int m)
		: head(n + 1, 0), next(n << 1, 0), to(n << 1, 0), vertex(n + 1, 0), //
		  power(log2(n)), stjump(n + 1, vector<int>(power + 1, 0)), deep(n + 1, 0)
	{
                cnt = 1;
                ans = 0;

		for (int i = 0, u, v; i < n - 1; i++) {
			cin >> u >> v;
			addedge(u, v);
			addedge(v, u);
		}

                dfs(1, 0);

                for(int i = 0, u, v, c; i < m; i++){
                        cin >> u >> v;
                        c = lca(u, v);
                        vertex[u]++;
                        vertex[v]++;
                        vertex[c] -= 2;
                }
                dfs2(1, 0, m);
                cout << ans << '\n';
	}
};

int main()
{
        ios::sync_with_stdio(false);
        cin.tie(0);
	int n = 0, m = 0;
	cin >> n >> m;
        App app(n, m);
        return 0;
}